<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>居中</title>
    <style>
        .outer{
            width: 400px;
            height: 400px;
            /*display: inline-block;*/

            background: red;

        }
        .inner{
            width: 100px;
            height: 100px;
            margin: 0 auto;
            background: blue;
        }
    </style>
</head>
<body>
<div class="outer">
    <div class="inner"></div>
</div>
</body>
</html>